Skip to content

[codex] Structure client VCS action errors#3263

Merged
juliusmarminge merged 3 commits into
mainfrom
codex/vcs-action-errors
Jun 20, 2026
Merged

[codex] Structure client VCS action errors#3263
juliusmarminge merged 3 commits into
mainfrom
codex/vcs-action-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • replace message-only VCS action failures with structured tagged errors and a schema union
  • retain action, logical/transport IDs, environment, repository, phase, and remote detail at the failure boundary
  • remove the unavailable-result constructor wrapper and construct target-aware errors directly

Validation

  • vp test packages/client-runtime/src/state/vcsAction.test.ts (11 tests)
  • vp check (passes; 20 pre-existing warnings)
  • vp run typecheck

Note

Medium Risk
Changes error types and messages across all VCS action entry points and progress consumption; UI that matched on old string messages may need updates, but behavior for successful paths is unchanged.

Overview
Replaces ad-hoc string failures for client source-control actions with Effect Schema tagged errors that carry operation, target, and action identity instead of copying sensitive remote text into error messages.

VcsActionUnavailableError now includes operation, environmentId, and cwd with a derived user-facing message; web hooks in sourceControlActions.ts build this inline after removing unavailableResult. consumeVcsActionProgress splits execution failures into VcsActionRemoteFailureError (phase + remoteMessageLength only) and VcsActionMissingTerminalEventError when the progress stream never terminates; VcsActionExecutionError is now a union of those two. parseVcsActionTargetKey is schema-validated and throws VcsActionTargetKeyParseError with key length and native cause, not the raw key. The stacked-action command cache keys unavailable targets per partial environmentId/cwd rather than a single shared unavailable key.

Tests assert diagnostics stay structural and do not embed credentials or full remote payloads in .message.

Reviewed by Cursor Bugbot for commit fa41678. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Structure VCS action errors with operation, environmentId, and cwd context

  • Replaces free-form message strings in VcsActionUnavailableError with structured fields (operation, environmentId, cwd) and a standardized message getter across all VCS action hooks in sourceControlActions.ts.
  • Introduces two new error classes in vcsAction.ts: VcsActionRemoteFailureError (for action_failed events, omitting remote message body but recording its length) and VcsActionMissingTerminalEventError (for protocol cases with no terminal event).
  • Adds VcsActionTargetKeyParseError for invalid target key parsing, reporting only key length to avoid leaking sensitive content.
  • Removes the unavailableResult helper and replaces all call sites with direct AsyncResult.failure construction using the new structured error shape.
  • Behavioral Change: callers of consumeVcsActionProgress and track() now receive specific typed error variants instead of a generic error; remote failure messages are no longer forwarded to the client.

Macroscope summarized fa41678.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ab9d1648-8c17-4192-85b6-dfae4ae2cc2e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/vcs-action-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR restructures VCS action error classes to include structured context fields (operation, environmentId, cwd) instead of plain message strings. The refactor is mechanical with no changes to error-throwing logic or runtime behavior, and includes comprehensive tests for the new error shapes.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 13:52

Dismissing prior approval to re-evaluate 8fadd1b

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 17:02

Dismissing prior approval to re-evaluate fa41678

@juliusmarminge
juliusmarminge merged commit ff0f702 into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/vcs-action-errors branch June 20, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant